package com.gshrms.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.gshrms.common.core.domain.CommonResult;
import com.gshrms.system.domain.SysUserMenus;
import com.gshrms.system.domain.dto.GetAuthorityLimitDto;
import com.gshrms.system.mapper.SysUserMenusMapper;
import com.gshrms.system.service.ISysUserMenusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户关联的菜单权限 服务实现类
 * </p>
 *
 * @author laoyang
 * @since 2025-03-14
 */
@Service
public class SysUserMenusServiceImpl extends ServiceImpl<SysUserMenusMapper, SysUserMenus> implements ISysUserMenusService {

    @Autowired
    SysUserMenusMapper sysUserMenusMapper;


    /**
     * 查询某个用户在某个页面有哪些数据权限
     * @param getAuthorityLimitDto
     * @return
     */
    @Override
    public CommonResult getAuthorityLimitByUserMenu(GetAuthorityLimitDto getAuthorityLimitDto) {
        Long menuId = getAuthorityLimitDto.getMenuId();
        Long userId = getAuthorityLimitDto.getUserId();
        List<Long> authorityLimit = sysUserMenusMapper.getAuthorityLimitByUserMenu(userId,menuId);
        return CommonResult.success(authorityLimit);
    }

}
